home *** CD-ROM | disk | FTP | other *** search
/ Stickerpedia Stickerbook / Stickerbook.iso / pc / DATA / behaviours.cxt / 00002_Script_ [ global ] Button < prev    next >
Text File  |  2003-03-23  |  3KB  |  167 lines

  1.  
  2.  
  3.  
  4.  
  5. global  oSpr
  6. global  gDontReact
  7. global  gCurrentCursor
  8.  
  9. property  spriteNum
  10. property  pChangeCursor
  11. property  pUpstate
  12. property  pLeaveState
  13. property  pNoHilite
  14. property  pOriginalState
  15. property  pDisabled
  16. property  pIgnoreDontReact
  17.  
  18.  
  19.  
  20. on beginSprite me
  21.   pDisabled = 0
  22. end
  23.  
  24.  
  25.  
  26. on disable me
  27.   -- this handler can be called to temporarily disable the script
  28.   -- for example from a handler which checks whether a text field is empty
  29.   
  30.   pDisabled = 1
  31.   
  32.   modify (oSpr, spriteNum, #std)
  33.   if rollover(spriteNum) then cursor -1
  34.   updatestage
  35. end
  36.  
  37.  
  38. on enterFrame me
  39.   --  put "gDontReact" && gDontReact 
  40. end
  41.  
  42.  
  43.  
  44.  
  45. on enable me
  46.   -- this handler can be called to temporarily disable the script
  47.   -- for example from a handler which checks whether a text field is empty
  48.   
  49.   pDisabled = 0
  50.   
  51.   if rollover(spriteNum) then
  52.     cursor 280
  53.     modify (oSpr, spriteNum, #hiL)
  54.     updatestage
  55.   end if
  56. end
  57.  
  58.  
  59. on mouseEnter me
  60. --  put "gDontReact" && gDontReact
  61. --  put "pDisabled" && pDisabled
  62.   
  63.   
  64.   
  65.   if (gDontReact OR pDisabled) and (not pIgnoreDontReact) then 
  66.     exit
  67.   else
  68.     if pChangeCursor then
  69.       cursor 280
  70.       gCurrentCursor = 280
  71.     end if
  72.     
  73.     if pNoHilite then exit
  74.     
  75.     pOriginalState = getState (oSpr, spriteNum)
  76.     if pOriginalState = #sel then exit
  77.     
  78.     
  79.     modify (oSpr, spriteNum, #hil)
  80.     
  81.     if pLeaveState = #asBefore then
  82.       pLeaveState =  pOriginalState
  83.     end if
  84.   end if
  85. end
  86.  
  87.  
  88.  
  89.  
  90. on mouseLeave me
  91.     if (gDontReact OR pDisabled) and (not pIgnoreDontReact) then 
  92.       exit
  93.     else
  94.   if pChangeCursor then 
  95.     cursor -1
  96.     gCurrentCursor = -1
  97.   end if
  98.   
  99.   if pNoHilite then exit
  100.   pOriginalState = getState (oSpr, spriteNum)
  101.   if pOriginalState = #sel then exit
  102.   
  103.   modify oSpr, spriteNum, pLeaveState
  104.   end if
  105. end
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114. on mouseDown me, callingOption
  115.   
  116.   if (gDontReact OR pDisabled) and (not pIgnoreDontReact) then 
  117.     exit
  118.   else
  119.     
  120.     pOriginalState = getState (oSpr, spriteNum)
  121.     if pOriginalState = #sel then exit
  122.     
  123.     modify oSpr, spriteNum, #dwn  
  124.     updatestage
  125.     
  126.     repeat while the stillDown
  127.     end repeat
  128.     
  129.     if callingOption = #withOutMouse then
  130.       modify oSpr, spriteNum, pUpstate
  131.       sendSprite spritenum, #msUp  
  132.     else
  133.       
  134.       if rollover(spriteNum) then
  135.         modify oSpr, spriteNum, pUpstate
  136.         sendSprite spritenum, #msUp  
  137.       else
  138.         modify oSpr, spriteNum, pOriginalState
  139.       end if
  140.       
  141.     end if
  142.     
  143.     updatestage
  144.     
  145.   end if
  146. end
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153. on getPropertyDescriptionList me
  154.   set description = [:]
  155.   addProp description, #pNoHilite,          [#comment: "No Hilite on rollover",         #format: #boolean, #default: 0]
  156.   addProp description, #pChangeCursor,      [#comment: "Change cursor",                 #format: #boolean, #default: 1]
  157.   addProp description, #pUpstate,           [#comment: "State of button on mouseUp",    #format: #symbol,  #default: #hiL, #range:[#std, #hiL, #dwn, #sel, #ict, #none]]
  158.   addProp description, #pLeaveState,        [#comment: "State of button on mouseLeave", #format: #symbol,  #default: #std, #range:[#std, #hiL, #dwn, #sel, #ict, #none, #asBefore]]
  159.   addProp description, #pIgnoreDontReact,   [#comment: "Ignore gDontReact - f.e. if Alert box Ok Button", #format: #boolean,  #default: 0]
  160.   return description
  161. end 
  162.  
  163.  
  164.  
  165.  
  166.  
  167.